import { HTMLElement } from 'node-html-parser';
import s from './ns';
import P01 from './P01';
import { IFeidaoAiNodejsComponent } from '@feidao/web/interfaces';
import nodejs from '@feidao/web/atom/nodejs/msg-b/nodejs';
import render from '@feidao/web/atom/nodejs/render/render';
import init from '@feidao/web/framework/nodejs/d/component';

const daoke = {
	async init(fd: IFeidaoAiNodejsComponent, ...args: any[]) {
		console.log('zj-classroom-001 init nb', args);
		let page_no = fd.data.params['page_no'];
		if (!page_no) {
			page_no = 1;
		}
		let page_size = fd.data.params['page_size'];
		if (!page_size) {
			page_size = 20;
		}
		const query = {
			criteria: {},
			page_no,
			page_size,
			asc: ['fzno']
		};
		const res = await nodejs("flippedclass", "class_room_find", query);
		if (res.c != 0) {
			render(fd.data.node, res.t, P01, 'P01');
		}
	}
};
export default function main(html: HTMLElement, url: string, query: any) {
	return init('zj-classroom-export-001', s, daoke, html, url, query, { spaceid: 'flippedclass', systemid: '5991', refsystemid: '@refsystemid' });
}
